examineOrderTS <- function (OrderTS) {
  rownames = c("numberOfTrades", "stopPct", "stoplossPct", "stopWinPct", "returnMean", "returnSd", "pctWin")
  rows <- dim(OrderTS)[1]
  numberOfTrades <- rows
  stopPct        <- (colSums(OrderTS[,"S_L"]) + colSums(OrderTS[,"S_W"]))*100/rows
  stoplossPct    <- colSums(OrderTS[,"S_L"])*100/rows
  stopwinPct     <- colSums(OrderTS[,"S_W"])*100/rows
  returnMean     <- colMeans(OL[,"return"])*100
  returnSd       <- colSd(OL[,"return"])*100
  pctWin         <- colSums(OL[,"return"] >= 0)
  result <- data.frame(c(numberOfTrades, stopPct, stoplossPct, stopwinPct, returnMean, returnSd, pctWin), row.names=rownames)
  colnames(result) <- "value"
  return (result)
}

examineOrderTSDF <- function (OrderTS) {
  rownames = c("numberOfTrades", "stopPct", "stoplossPct", "stopwinPct", "returnMean", "returnSd", "returnDDev", "pctWin")
  rows <- dim(OrderTS)[1]
  
  numberOfTrades <- rows
  if (rows == 0) {
    stopPct     <- 0
    stoplossPct <- 0
    stopwinPct  <- 0
    returnMean  <- 0
    returnSd    <- 0
    returnDDev  <- 0
    pctWin      <- 0
  } else {
    stopPct        <- (sum(OrderTS$S_L)+ sum(OrderTS$S_W)) / rows *100
    stoplossPct    <- sum(OrderTS$S_L) / rows *100
    stopwinPct     <- sum(OrderTS$S_W) / rows *100
    returnMean     <- mean(OrderTS$return) * 100
    returnSd       <- sd(OrderTS$return) * 100
    returnDDev     <- DownsideDeviation(OrderTS$return, MAR=0, method="full") *100
    pctWin         <- sum(OrderTS$return>=0) / rows *100
  }
  result <- data.frame(c(numberOfTrades, stopPct, stoplossPct, stopwinPct, returnMean, returnSd, returnDDev, pctWin), row.names=rownames)
  colnames(result) <- "value"
  return (result)
}